package com.cms.cmsbackend.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override

    // addInterceptor 注册拦截器
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new CmsInterceptor())
                //拦截器要拦截的请求 /**代表拦截所有的请求
                .addPathPatterns("/**")
                //需要不被拦截的请求或者说放行的请求
                .excludePathPatterns("/v2/api-docs",
                "/swagger-resources",
                "/swagger-resources/**",
                "/swagger-ui.html/**",
                "/webjars/**","/Customer/login");
    }
}
